<template>
  <view class="root">
    <view class="content-wrapper" scroll-y="true">
      <yy-scroll-view ref="houseListRef" :request-url="HOUSE_LIST" :auto-request="false">
        <template slot-scope="{list}">
          <view data-url="/selfInfo/myHouse/houseDetail" :data-params="{...item, isMain: item.isMain + ''}"
            class="scroll-item" v-for="(item, index) in list" :key="index" @click="navigatorTo">
            <image class="housing-manager" :src="`${baseImgUrl}house-owner.png`" v-if="item.isMain"></image>
            <image class="left-img" :src="`${baseImgUrl}house-icon-1.png`"></image>
            <view class="right-wrapper">
              <view class="name">{{item.bName}}</view>
              <view class="address">{{item.roomName}}</view>
            </view>
          </view>
        </template>
      </yy-scroll-view>
    </view>
    <yy-watermark></yy-watermark>
  </view>
</template>

<script>
  import {
    HOUSE_LIST
  } from '../../api/api'

  import {
    navigatorTo
  } from '@/utils/util.js'

  export default {
    data() {
      return {
        HOUSE_LIST,
        baseImgUrl: this.$baseImgUrl,
        pageInfo: {
          pageNo: 1,
          pageSize: 10
        },
        finished: false,
        loading: false,
        houseList: [],
        pages: 0
      }
    },
    onShow() {
      this.$refs.houseListRef.getList()
    },
    methods: {
      navigatorTo
    }
  }
</script>


<style lang="scss">
  page {
    background: #F9F9F9;
  }
</style>
<style lang="scss" scoped>
  .root {
    padding: 14rpx;
    height: 100%;

    .content-wrapper {
      height: 100%;

      .scroll-item {
        background: #FFFFFF;
        border-radius: 16rpx 16rpx 16rpx 16rpx;
        display: flex;
        margin-bottom: 12rpx;
        position: relative;
        padding: 20rpx 26rpx;

        .housing-manager {
          position: absolute;
          right: 0;
          top: 0;
          width: 131.52rpx;
          height: 134.95rpx
        }

        .left-img {
          width: 132rpx;
          height: 132rpx;
          border-radius: 24rpx 24rpx 24rpx 24rpx;
          margin-right: 15rpx;
        }

        .right-wrapper {
          .name {
            margin-top: 11rpx;
            margin-bottom: 21rpx;
            font-weight: bold;
            font-size: 36rpx;
            color: #000000;
          }

          .address {
            font-weight: 500;
            font-size: 28rpx;
            color: #AAAAAA;
          }
        }
      }
    }
  }
</style>